"""
序列化生成器
"""
from rest_framework import serializers

from users.models import Department, Employee


class DepartmentSerializer(serializers.ModelSerializer):
    """部门表的序列化生成器"""
    class Meta:
        model = Department
        fields = '__all__'

class EmployeeSerializer(serializers.ModelSerializer):
    """员工表的序列化生成器"""
    class Meta:
        model = Employee
        # 明确指定序列化器要包含的字段。
        fields = [
            'id','name','age','salary','create_time',
            'gender','gender_display',
            'depart','depart_title'
        ]
